home *** CD-ROM | disk | FTP | other *** search
- Path: lrz-muenchen.de!news
- From: watzka@stat.uni-muenchen.de (Kurt Watzka)
- Newsgroups: comp.lang.c
- Subject: Re: Help:what is wrong this code?
- Date: 6 Apr 1996 10:09:50 GMT
- Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
- Distribution: world
- Message-ID: <4k5fte$163@sparcserver.lrz-muenchen.de>
- References: <4k3p3q$n76@brahms.udel.edu> <31662D76.96A@public.sta.net.cn>
- NNTP-Posting-Host: sun2.lrz-muenchen.de
-
- Xu Yifeng <jafd@public.sta.net.cn> writes:
-
- >Yue-hong Zheng wrote:
- >/>
- >/> Why it give me 0.0000?
- >/>
- >/> #include <stdio.h>
- >/> main () {
- >/> double a=9.008;
- >/> printf("%f\n",sqrt(a));
- >/> return 0;
- >/> }
-
- >the format string is error, the sentence should be "printf("%e\n", sqrt(a));"
-
- Not so obvious jokes should be marked with something like :-), whereas
- sheer sarcasm could sometimes go undeclared. If you want to give a
- misleading answer, at least make it possible to detect.
-
- "%f" is as valid as "%e" for printing a double.
-
- Kurt
- --
- | Kurt Watzka Phone : +49-89-2180-6254
- | watzka@stat.uni-muenchen.de
-